import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
import { param } from 'common/src/utils';
import axios from 'axios';
const BASER_SERV_URL = '/api/baseresservice';

function getFundList(key) {
  return fetch({
    url: `${baseUrl}/pgFundAmount/getFundList`,
    method: 'get'
  });
}
// 项目类别管理列表查询
function projectTypes(data) {
  return fetch({
    url: baseUrl + "/projectTypes/listTypes",
    // url: "/dev/projectTypes/listTypes",
    method: 'post',
    data
  });
}

// 项目类别管理新增
function projectTypesAdd(data) {
  return fetch({
    url: baseUrl + "/projectTypes/insertTypes",
    method: 'post',
    data
  });
}

// 项目类别管理编辑
function projectTypesEidt(data) {
  return fetch({
    url: baseUrl + "/projectTypes/editTypes",
    method: 'post',
    data
  });
}


// 项目类别管理编辑回显
function projectTypesDetail(data) {
  return fetch({
    url: baseUrl + "/projectTypes/detailTypes",
    method: 'post',
    data
  });
}

// 项目类别管理删除
function projectTypesDelete(data) {
  return fetch({
    url: baseUrl + "/projectTypes/deleteTypes",
    method: 'post',
    data
  });
}
// 项目类别下拉框数据
function projectTypesSelect(data) {
  return fetch({
    url: baseUrl + "/projectTypes/selectTypes",
    method: 'post',
    data
  });
}

// 留学内容列表查询
function studyAbroadList(data) {
  return fetch({
    url: baseUrl + "/studyAbroad/listContent",
    // url: "dev/studyAbroad/listContent",
    method: 'post',
    data
  });
}

// 留学内容新增
function studyAbroadAdd(data) {
  return fetch({
    url: baseUrl + "/studyAbroad/insertContent",
    // url: "dev/studyAbroad/insertContent",
    method: 'post',
    data
  });
}

// 留学内容编辑
function studyAbroadEdit(data) {
  return fetch({
    url: baseUrl + "/studyAbroad/editContent",
    // url: "dev/studyAbroad/editContent",
    method: 'post',
    data
  });
}
// 留学内容编辑回显
function studyAbroadDetail(data) {
  return fetch({
    url: baseUrl + "/studyAbroad/detailContent",
    method: 'post',
    data
  });
}


// 留学内容删除
function studyDelete(data) {
  return fetch({
    url: baseUrl + "/studyAbroad/deleteContent",
    method: 'post',
    data
  });
}

// 留学内容开关变更(启用状态)
function changeContentStatus(data) {
  return fetch({
    url: baseUrl + "/studyAbroad/changeContentStatus",
    method: 'post',
    data
  });
}

// 编辑资助额度
function updateFundById(data) {
  return fetch({
      url: `${baseUrl}/pgFundAmount/updateFundById`,
      method: 'Post',
      data
  });
}

// 编辑会议资助额度限制-可用于报销内容
function updateFundContentById(data) {
  return fetch({
      url: `${baseUrl}/pgFundAmount/updateFundContentById?reimburseContent=${data.reimburseContent}&&ids=${data.ids}`,
      method: 'get',
      data
  });
}

//国际交流开关列表
function exchangeSwitch(data) {
  return fetch({
    url: baseUrl + "/exchangeSwitch/listSwitch",
    method: 'post',
    data
  });
}

//国际交流开关列表新增
function exchangeSwitchAdd(data) {
  return fetch({
    url: baseUrl + "/exchangeSwitch/addSwitch",
    method: 'post',
    data
  });
}

//国际交流开关列表编辑
function exchangeSwitchEdit(data) {
  return fetch({
    url: baseUrl + "/exchangeSwitch/editSwitch",
    method: 'post',
    data
  });
}

// 国际交流开关编辑回显
function exchangeSwitchDetail(data) {
  return fetch({
    url: baseUrl + "/exchangeSwitch/detailSwitch",
    method: 'post',
    data
  });
}

//国际交流开关列表删除
function exchangeSwitchDelete(data) {
  return fetch({
    url: baseUrl + "/exchangeSwitch/deleteSwitch",
    method: 'post',
    data
  });
}

//国际交流开关变更(启用状态)
function exchangeSwitchChangeDelete(data) {
  return fetch({
    url: baseUrl + "/exchangeSwitch/changeSwitch",
    method: 'post',
    data
  });
}

// 学院开关列表
function collegeSwitch(data) {
  return fetch({
    url: baseUrl + "/collegeSwitch/listSwitch",
    method: 'post',
    data
  });
}

//学院开关列表新增
function collegeSwitchAdd(data) {
  return fetch({
    url: baseUrl + "/collegeSwitch/addSwitch",
    method: 'post',
    data
  });
}

//学院开关列表编辑
function collegeSwitchEdit(data) {
  return fetch({
    url: baseUrl + "/collegeSwitch/editSwitch",
    method: 'post',
    data
  });
}


// 学院开关编辑回显
function collegeSwitchDetail(data) {
  return fetch({
    url: baseUrl + "/collegeSwitch/detailSwitch",
    method: 'post',
    data
  });
}

// 学院开关列表删除
function collegeSwitchDelete(data) {
  return fetch({
    url: baseUrl + "/collegeSwitch/deleteSwitch",
    method: 'post',
    data
  });
}

//学院开关变更(启用状态)
function collegeSwitchChangeDelete(data) {
  return fetch({
    url: baseUrl + "/collegeSwitch/changeSwitch",
    method: 'post',
    data
  });
}

// 境外合作院校列表
function overseasCollege(data) {
  return fetch({
    url: baseUrl + "/overseasCollege/listCollege",
    method: 'post',
    data
  });
}

// 境外合作院校列表新增
function overseasCollegeAdd(data) {
  return fetch({
    url: baseUrl + "/overseasCollege/addCollege",
    method: 'post',
    data
  });
}


//境外合作院校列表编辑
function overseasCollegeEdit(data) {
  return fetch({
    url: baseUrl + "/overseasCollege/editCollege",
    method: 'post',
    data
  });
}

// 境外合作院校列表删除
function overseasCollegeDelete(data) {
  return fetch({
    url: baseUrl + "/overseasCollege/deleteCollege",
    method: 'post',
    data
  });
}

// 境外合作院校列表编辑回显
function overseasCollegeDetail(data) {
  return fetch({
    url: baseUrl + "/overseasCollege/detailCollege",
    method: 'post',
    data
  });
}

// 境外合作院校列表导入
function importOverseasCollege(data) {
  return fetch({
    url: baseUrl + "/overseasCollege/importOverseasCollege",
    method: 'post',
    data
  });
}

// 境外合作院校列表下载
function downloadTemplate(data) {
  return fetch({
    url: baseUrl + "/overseasCollege/downloadTemplate",
    method: 'get',
    responseType: 'blob'
  }).then(res => {
    UTILS.downloadFile(res, '境外合作院校模板.xls', 'application/vnd.ms-excel;charset=utf-8');
  });
}

// 境外合作院校列表导出
// function overseasCollegeExcel(data) {
//   return fetch({
//       url: baseUrl + "/overseasCollege/downExcel",
//       method: 'post',
//       data
//   });
// }

function overseasCollegeExcel(data) {
  return fetch({
    url: baseUrl + "/overseasCollege/downExcel",
    method: 'post',
    responseType: 'blob',
    data
  }).then(res => {
    UTILS.downloadFile(res, 'OverseasCollege.xlsx', 'application/octet-stream;charset=utf-8');
  });
}

// 项目名称下来框选择
function listProject(data) {
  return fetch({
    url: baseUrl + "/projectTypes/listProject",
    method: 'post',
    data
  });
}


export default {
  'getFundList': getFundList,
  'projectTypes': projectTypes,
  'projectTypesAdd': projectTypesAdd,
  'projectTypesEidt': projectTypesEidt,
  'projectTypesDelete': projectTypesDelete,
  'projectTypesSelect': projectTypesSelect,
  // 'projectTypesDetail': projectTypesDetail,
  'studyAbroadList': studyAbroadList,
  'studyAbroadAdd': studyAbroadAdd,
  'studyAbroadEdit':studyAbroadEdit,
  'studyAbroadDetail':studyAbroadDetail,
  'studyDelete': studyDelete,
  'changeContentStatus':changeContentStatus,
  'exchangeSwitch':exchangeSwitch,
  'exchangeSwitchAdd':exchangeSwitchAdd,
  'exchangeSwitchEdit':exchangeSwitchEdit,
  'exchangeSwitchDetail':exchangeSwitchDetail,
  'exchangeSwitchDelete':exchangeSwitchDelete,
  'updateFundById':updateFundById,
  'collegeSwitch':collegeSwitch,
  'collegeSwitchAdd':collegeSwitchAdd,
  'collegeSwitchEdit':collegeSwitchEdit,
  'collegeSwitchDetail':collegeSwitchDetail,
  'collegeSwitchDelete':collegeSwitchDelete,
  'overseasCollege':overseasCollege,
  'overseasCollegeAdd':overseasCollegeAdd,
  'overseasCollegeEdit':overseasCollegeEdit,
  'overseasCollegeDelete':overseasCollegeDelete,
  'overseasCollegeDetail':overseasCollegeDetail,
  'projectTypesDetail':projectTypesDetail,
  'listProject':listProject,
  'overseasCollegeExcel':overseasCollegeExcel,
  'exchangeSwitchChangeDelete':exchangeSwitchChangeDelete,
  'collegeSwitchChangeDelete':collegeSwitchChangeDelete,
  'updateFundContentById': updateFundContentById,
  'importOverseasCollege':importOverseasCollege,
  'downloadTemplate':downloadTemplate

};

